//
//  VisitorDetailModel.m
//  ppkc2016
//
//  Created by Laura on 2017/3/22.
//  Copyright © 2017年 拼凑的断音. All rights reserved.
//

#import "VisitorDetailModel.h"
#import "XXTool.h"

@implementation VisitorDetailModel

+(void)requestVisitorDetailInfoType:(NSString *)id
                             completion:(void (^)(BOOL, NSMutableArray<VisitorDetailModel *> *,NSString*,NSString*))block
{
    NSString *lang=@"en";
    if([XXTool didCurrentLanguageChinese]){
        lang=@"zh";
    }
    [DKHTTPRequest sendNewDataWithShortUrl:@"gz_data_detail"
                                     Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&orderid=%@&lang=%@",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword,id,lang]]
                                ImageArray:nil
                                   TimeOut:10
                                Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                    if ([[serverDic objectForKey:@"code"] intValue]==200)
                                    {
                                        NSMutableArray *dataList = [[NSMutableArray alloc] init];
                                        
                                            NSArray *list = [serverDic objectForKey:@"gzdetail"];
                                            for (int i=0; i<list.count; i++)
                                            {
                                                VisitorDetailModel *temp = [VisitorDetailModel modelWithDictionary:list[i]];
                                                [dataList addObject:temp];
                                            }
                                       
                                        block(YES
                                              ,dataList
                                              ,[serverDic objectForKey:@"orderid"] == [NSNull null]?@"":[serverDic objectForKey:@"orderid"]
                                              ,[serverDic objectForKey:@"headphoto"] == [NSNull null]?@"":[serverDic objectForKey:@"headphoto"]);
                                    }
                                    else
                                    {
                                        block(NO,nil,nil,nil);
                                        
                                    }
                                    return YES;
                                } IsBuffering:YES
                         IsNeedReplaceWrap:NO
                           IsUseUpLoadHead:NO];
}


@end
